package com.ktjiaoyu.common;

/**
 * @version 1.0
 * @EnumName CodeConstant
 * @Description 响应状态码枚举类
 * @Author NanJi
 * @Date 2025/4/9 : 15:00
 */
public enum CodeConstant {
    SUCCESS(0, "操作成功"),
    FAIL(1, "操作失败"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源未找到"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用");

    // 状态码
    private final int code;
    // 消息
    private final String message;

    CodeConstant(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
